{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 112,
   "id": "41c79457",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import math\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import datetime\n",
    "import time\n",
    "import random\n",
    "from datetime import date\n",
    "import pandas_ta as ta\n",
    "from ta.volatility import KeltnerChannel\n",
    "import matplotlib.pyplot as plt\n",
    "import plotly.graph_objects as go\n",
    "from plotly.subplots import make_subplots\n",
    "from yahoo_fin import stock_info as si\n",
    "import datetime\n",
    "from pandas.tseries.holiday import USFederalHolidayCalendar\n",
    "from pandas.tseries.offsets import CustomBusinessDay\n",
    "US_BUSINESS_DAY = CustomBusinessDay(calendar=USFederalHolidayCalendar())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "id": "366f8a71",
   "metadata": {},
   "outputs": [],
   "source": [
    "def load_historic_data(symbol):\n",
    "    today = datetime.date.today()\n",
    "    today_str = today.strftime(\"%Y-%m-%d\")\n",
    "    #  Get last year's data\n",
    "    start_date = today - (251 * US_BUSINESS_DAY)\n",
    "    start_date_str = datetime.datetime.strftime(start_date, \"%Y-%m-%d\")\n",
    "    # Download data from Yahoo Finance\n",
    "    try:\n",
    "        df = si.get_data(symbol, start_date=start_date_str, end_date=today_str, index_as_date=False)\n",
    "        return df\n",
    "    except:\n",
    "        print('Error loading stock data for ' + symbol)\n",
    "        return None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "id": "aa74cebd",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calculate_keltner_channels(df):\n",
    "    # Initialize Keltner Channel Indictor\n",
    "    indicator_keltner = KeltnerChannel(high=df['high'], low=df['low'], close=df[\"adjclose\"], window=20)\n",
    "\n",
    "    # Add Keltner Channel features\n",
    "    df['keltner_mband'] = indicator_keltner.keltner_channel_mband()\n",
    "    df['keltner_hband'] = indicator_keltner.keltner_channel_hband()\n",
    "    df['keltner_lband'] = indicator_keltner.keltner_channel_lband()\n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "id": "10a2690e",
   "metadata": {},
   "outputs": [],
   "source": [
    "def apply_strategy_rules(df):\n",
    "    #  Entry Rule 1: Price breaks through the high channel\n",
    "    df['keltner_entry_signal'] = np.where((df[\"adjclose\"] >= df[\"keltner_hband\"]) & (df[\"adjclose\"].shift() < df[\"keltner_hband\"]), 1, 0)\n",
    "    \n",
    "    #  Exit rule: Price drops below the mid channel\n",
    "    df['keltner_exit_signal'] = np.where((df[\"adjclose\"] <= df[\"keltner_mband\"]) & (df[\"adjclose\"].shift() > df[\"keltner_mband\"]), 1, 0)\n",
    "\n",
    "    return df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "id": "34e67339",
   "metadata": {},
   "outputs": [],
   "source": [
    "def execute_strategy(df):\n",
    "    close_prices = df['adjclose']\n",
    "    keltner_entry_signals = df['keltner_entry_signal']\n",
    "    keltner_exit_signals = df['keltner_exit_signal']\n",
    "    entry_prices = []\n",
    "    exit_prices = []\n",
    "    entry_signal = 0\n",
    "    exit_signal = 0\n",
    "    hold = 0\n",
    "    \n",
    "    for i in range(len(close_prices)):\n",
    "        #  Check entry and exit signals\n",
    "        if keltner_entry_signals[i] == 1:\n",
    "            entry_signal = 1\n",
    "        else:\n",
    "            entry_signal = 0\n",
    "        if keltner_exit_signals[i] == 1:\n",
    "            exit_signal = 1\n",
    "        else:\n",
    "            exit_signal = 0\n",
    "            \n",
    "        #  Add entry prices\n",
    "        if hold == 0 and entry_signal == 1:\n",
    "            buy_price = close_prices[i]\n",
    "            entry_prices.append(close_prices[i])\n",
    "            exit_prices.append(np.nan)  \n",
    "            entry_signal = 0\n",
    "            hold = 1\n",
    "        #  Evaluate exit strategy\n",
    "        elif hold == 1 and exit_signal == 1:\n",
    "            entry_prices.append(np.nan)\n",
    "            exit_prices.append(close_prices[i]) \n",
    "            exit_signal = 0\n",
    "            hold = 0\n",
    "        else:\n",
    "            #  Neither entry nor exit\n",
    "            entry_prices.append(np.nan) \n",
    "            exit_prices.append(np.nan) \n",
    "            \n",
    "    return entry_prices, exit_prices"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "id": "fe9b672c",
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_graph(df, entry_prices, exit_prices):\n",
    "    keltner_high = df['keltner_hband']\n",
    "    keltner_mid = df['keltner_mband']\n",
    "    keltner_low = df['keltner_lband']\n",
    "    fig = make_subplots(rows=1, cols=1)\n",
    "\n",
    "    #  Plot close price\n",
    "    fig.add_trace(go.Line(x = df.index, y = df['adjclose'], line=dict(color=\"blue\", width=1), name=\"Close\"), row = 1, col = 1)\n",
    "    \n",
    "    #  Plot Keltner Channels\n",
    "    fig.add_trace(go.Line(x = df.index, y = keltner_high, line=dict(color=\"#ffdf80\", width=1), name=\"KC High\"), row = 1, col = 1)\n",
    "    fig.add_trace(go.Line(x = df.index, y = keltner_mid, line=dict(color=\"#ffd866\", width=1), name=\"KC Mid\"), row = 1, col = 1)\n",
    "    fig.add_trace(go.Line(x = df.index, y = keltner_low, line=dict(color=\"#ffd24d\", width=1), name=\"KC Low\"), row = 1, col = 1)\n",
    "    \n",
    "    #  Add buy and sell indicators\n",
    "    fig.add_trace(go.Scatter(x=df.index, y=entry_prices, marker_symbol=\"arrow-up\", marker=dict(\n",
    "        color='green',\n",
    "    ),mode='markers',name='Buy'))\n",
    "    fig.add_trace(go.Scatter(x=df.index, y=exit_prices, marker_symbol=\"arrow-down\", marker=dict(\n",
    "        color='red'\n",
    "    ),mode='markers',name='Sell'))\n",
    "    \n",
    "    fig.update_layout(\n",
    "        title={'text':'Keltner Channel', 'x':0.5},\n",
    "        autosize=False,\n",
    "        width=900,height=600)\n",
    "    fig.update_yaxes(range=[0,1000000000],secondary_y=True)\n",
    "    fig.update_yaxes(visible=False, secondary_y=True)  #hide range slider\n",
    "    \n",
    "    fig.show()\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "986345f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calculate_buy_hold_profit(investment, df):\n",
    "    close_prices = df['close']\n",
    "    buy_quantity = investment / close_prices[0]\n",
    "    sell_amount = buy_quantity * close_prices[len(close_prices)-1]\n",
    "    profit = sell_amount - investment\n",
    "    return profit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "id": "3cfaa127",
   "metadata": {},
   "outputs": [],
   "source": [
    "def calculate_strategy_profit(investment, entry_prices, exit_prices):\n",
    "    entry_price = 0\n",
    "    hold = 0\n",
    "    total_profit = 0\n",
    "    quantity = 0\n",
    "    available_funds = investment\n",
    "    purchase_amount = 0\n",
    "    \n",
    "    for i in range(len(entry_prices)):\n",
    "        current_entry_price = entry_prices[i]\n",
    "        current_exit_price = exit_prices[i]\n",
    "        \n",
    "        if not math.isnan(current_entry_price) and hold == 0:\n",
    "            entry_price = current_entry_price\n",
    "            quantity = available_funds / entry_price\n",
    "            purchase_amount = quantity * entry_price\n",
    "            hold = 1\n",
    "        elif hold == 1 and not math.isnan(current_exit_price):\n",
    "            hold = 0\n",
    "            proceeds = quantity * current_exit_price\n",
    "            profit_or_loss = proceeds - purchase_amount\n",
    "            available_funds = available_funds + profit_or_loss\n",
    "            total_profit += profit_or_loss\n",
    "        \n",
    "    return total_profit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "id": "1c34d9b0",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\dutch\\anaconda3\\envs\\tradesystem1\\lib\\site-packages\\plotly\\graph_objs\\_deprecations.py:378: DeprecationWarning:\n",
      "\n",
      "plotly.graph_objs.Line is deprecated.\n",
      "Please replace it with one of the following more specific types\n",
      "  - plotly.graph_objs.scatter.Line\n",
      "  - plotly.graph_objs.layout.shape.Line\n",
      "  - etc.\n",
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "line": {
          "color": "blue",
          "width": 1
         },
         "name": "Close",
         "type": "scatter",
         "x": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23,
          24,
          25,
          26,
          27,
          28,
          29,
          30,
          31,
          32,
          33,
          34,
          35,
          36,
          37,
          38,
          39,
          40,
          41,
          42,
          43,
          44,
          45,
          46,
          47,
          48,
          49,
          50,
          51,
          52,
          53,
          54,
          55,
          56,
          57,
          58,
          59,
          60,
          61,
          62,
          63,
          64,
          65,
          66,
          67,
          68,
          69,
          70,
          71,
          72,
          73,
          74,
          75,
          76,
          77,
          78,
          79,
          80,
          81,
          82,
          83,
          84,
          85,
          86,
          87,
          88,
          89,
          90,
          91,
          92,
          93,
          94,
          95,
          96,
          97,
          98,
          99,
          100,
          101,
          102,
          103,
          104,
          105,
          106,
          107,
          108,
          109,
          110,
          111,
          112,
          113,
          114,
          115,
          116,
          117,
          118,
          119,
          120,
          121,
          122,
          123,
          124,
          125,
          126,
          127,
          128,
          129,
          130,
          131,
          132,
          133,
          134,
          135,
          136,
          137,
          138,
          139,
          140,
          141,
          142,
          143,
          144,
          145,
          146,
          147,
          148,
          149,
          150,
          151,
          152,
          153,
          154,
          155,
          156,
          157,
          158,
          159,
          160,
          161,
          162,
          163,
          164,
          165,
          166,
          167,
          168,
          169,
          170,
          171,
          172,
          173,
          174,
          175,
          176,
          177,
          178,
          179,
          180,
          181,
          182,
          183,
          184,
          185,
          186,
          187,
          188,
          189,
          190,
          191,
          192,
          193,
          194,
          195,
          196,
          197,
          198,
          199,
          200,
          201,
          202,
          203,
          204,
          205,
          206,
          207,
          208,
          209,
          210,
          211,
          212,
          213,
          214,
          215,
          216,
          217,
          218,
          219,
          220,
          221,
          222,
          223,
          224,
          225,
          226,
          227,
          228,
          229,
          230,
          231,
          232,
          233,
          234,
          235,
          236,
          237,
          238,
          239,
          240,
          241,
          242,
          243,
          244,
          245,
          246,
          247,
          248,
          249,
          250,
          251,
          252,
          253
         ],
         "xaxis": "x",
         "y": [
          101.48999786376953,
          101.06999969482422,
          103.2699966430664,
          102.33999633789062,
          103.22000122070312,
          98.9000015258789,
          98.3499984741211,
          95.83999633789062,
          96.69999694824219,
          82.62000274658203,
          83.77999877929688,
          83.80999755859375,
          87.48999786376953,
          91.01000213623047,
          89.3499984741211,
          95.29000091552734,
          96.58000183105469,
          92.29000091552734,
          95.19000244140625,
          96.55000305175781,
          100.45999908447266,
          100.9000015258789,
          101.16000366210938,
          99.44000244140625,
          109.55999755859375,
          112.5999984741211,
          110.30999755859375,
          108.88999938964844,
          108.55000305175781,
          103.0999984741211,
          103.01000213623047,
          109.79000091552734,
          109.69000244140625,
          106.97000122070312,
          106.08000183105469,
          113.12000274658203,
          112.08999633789062,
          106.11000061035156,
          105.06999969482422,
          108.80999755859375,
          109.12000274658203,
          108.11000061035156,
          117.16999816894531,
          117.4800033569336,
          121.8499984741211,
          121.48999786376953,
          126.91999816894531,
          125.68000030517578,
          124.0199966430664,
          122.16000366210938,
          121.5999984741211,
          123.69000244140625,
          123.51000213623047,
          124.05999755859375,
          117.83999633789062,
          120.30999755859375,
          119.8499984741211,
          113.36000061035156,
          111.19000244140625,
          110.54000091552734,
          118.43000030517578,
          126.3499984741211,
          126.43000030517578,
          119.66999816894531,
          121.55000305175781,
          122.68000030517578,
          121.36000061035156,
          121.91999816894531,
          118.0999984741211,
          118.05000305175781,
          120.69000244140625,
          119.2699966430664,
          120.93000030517578,
          120.22000122070312,
          112.69000244140625,
          116.58000183105469,
          113.83999633789062,
          112.94999694824219,
          112.63999938964844,
          110.87999725341797,
          110,
          113.25,
          110.6500015258789,
          107.80000305175781,
          108.06999969482422,
          106.58999633789062,
          113.70999908447266,
          116.25,
          114.08999633789062,
          104.33999633789062,
          101.4800033569336,
          100.19000244140625,
          100.04000091552734,
          101,
          98.55999755859375,
          96.4800033569336,
          97.5,
          107.08000183105469,
          114.38999938964844,
          111.51000213623047,
          108.5,
          105.55999755859375,
          104.91999816894531,
          103.41999816894531,
          100.7300033569336,
          100.91999816894531,
          94.55000305175781,
          94.37999725341797,
          92.63999938964844,
          92.06999969482422,
          87.80000305175781,
          85.4000015258789,
          87.05000305175781,
          86.70999908447266,
          82.3499984741211,
          82.55999755859375,
          83.76000213623047,
          87.73999786376953,
          86.11000061035156,
          84.87000274658203,
          86.6500015258789,
          86.70999908447266,
          85.8499984741211,
          85.11000061035156,
          87.6500015258789,
          88.19000244140625,
          90.6500015258789,
          94.83000183105469,
          93.83000183105469,
          96.5999984741211,
          93.45999908447266,
          88.44999694824219,
          90.30999755859375,
          91.44000244140625,
          92.83000183105469,
          89.37000274658203,
          89.9000015258789,
          86.05999755859375,
          55.63999938964844,
          51.25,
          50.130001068115234,
          48.95000076293945,
          50.52000045776367,
          49.220001220703125,
          47.4900016784668,
          54.849998474121094,
          51.130001068115234,
          48.400001525878906,
          47.13999938964844,
          44.08000183105469,
          42.970001220703125,
          43.91999816894531,
          46.40999984741211,
          44.38999938964844,
          44,
          42.25,
          44.45000076293945,
          43.54999923706055,
          42.4900016784668,
          41.779998779296875,
          45.90999984741211,
          40.70000076293945,
          38.5099983215332,
          41.34000015258789,
          39.2599983215332,
          38.5,
          39.810001373291016,
          42.45000076293945,
          38.70000076293945,
          39.189998626708984,
          37.779998779296875,
          38.59000015258789,
          36.709999084472656,
          35.130001068115234,
          34.560001373291016,
          37.189998626708984,
          35.7599983215332,
          35.20000076293945,
          33.81999969482422,
          32.22999954223633,
          33.86000061035156,
          35.58000183105469,
          34.369998931884766,
          36.560001373291016,
          34.4900016784668,
          32.150001525878906,
          31.329999923706055,
          30.229999542236328,
          31.84000015258789,
          24.219999313354492,
          27.059999465942383,
          29.709999084472656,
          26.530000686645508,
          24.75,
          23.969999313354492,
          25.639999389648438,
          27.329999923706055,
          28.020000457763672,
          26.700000762939453,
          24.25,
          24.600000381469727,
          29.75,
          37.27000045776367,
          38.77000045776367,
          37.459999084472656,
          34.68000030517578,
          32.83000183105469,
          33.25,
          32.04999923706055,
          30.59000015258789,
          29.6299991607666,
          28.549999237060547,
          27,
          28.299999237060547,
          28.190000534057617,
          29.059999465942383,
          27.6200008392334,
          26.729999542236328,
          24.520000457763672,
          23.489999771118164,
          22.520000457763672,
          22.549999237060547,
          23.440000534057617,
          22.610000610351562,
          21.139999389648438,
          20.200000762939453,
          22.610000610351562,
          23.309999465942383,
          24.700000762939453,
          26.6200008392334,
          26.25,
          27.530000686645508,
          28.709999084472656,
          28.940000534057617,
          28.420000076293945,
          28.06999969482422,
          30.889999389648438,
          28.440000534057617,
          26.420000076293945,
          26.309999465942383,
          27.809999465942383,
          26.200000762939453,
          24.90999984741211,
          24.059999465942383,
          23.559999465942383,
          24.18000030517578,
          23.709999084472656,
          25.030000686645508,
          23.8700008392334,
          23.90999984741211,
          24.530000686645508,
          21.770000457763672,
          20.46500015258789,
          20.389999389648438
         ],
         "yaxis": "y"
        },
        {
         "line": {
          "color": "#ffdf80",
          "width": 1
         },
         "name": "KC High",
         "type": "scatter",
         "x": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23,
          24,
          25,
          26,
          27,
          28,
          29,
          30,
          31,
          32,
          33,
          34,
          35,
          36,
          37,
          38,
          39,
          40,
          41,
          42,
          43,
          44,
          45,
          46,
          47,
          48,
          49,
          50,
          51,
          52,
          53,
          54,
          55,
          56,
          57,
          58,
          59,
          60,
          61,
          62,
          63,
          64,
          65,
          66,
          67,
          68,
          69,
          70,
          71,
          72,
          73,
          74,
          75,
          76,
          77,
          78,
          79,
          80,
          81,
          82,
          83,
          84,
          85,
          86,
          87,
          88,
          89,
          90,
          91,
          92,
          93,
          94,
          95,
          96,
          97,
          98,
          99,
          100,
          101,
          102,
          103,
          104,
          105,
          106,
          107,
          108,
          109,
          110,
          111,
          112,
          113,
          114,
          115,
          116,
          117,
          118,
          119,
          120,
          121,
          122,
          123,
          124,
          125,
          126,
          127,
          128,
          129,
          130,
          131,
          132,
          133,
          134,
          135,
          136,
          137,
          138,
          139,
          140,
          141,
          142,
          143,
          144,
          145,
          146,
          147,
          148,
          149,
          150,
          151,
          152,
          153,
          154,
          155,
          156,
          157,
          158,
          159,
          160,
          161,
          162,
          163,
          164,
          165,
          166,
          167,
          168,
          169,
          170,
          171,
          172,
          173,
          174,
          175,
          176,
          177,
          178,
          179,
          180,
          181,
          182,
          183,
          184,
          185,
          186,
          187,
          188,
          189,
          190,
          191,
          192,
          193,
          194,
          195,
          196,
          197,
          198,
          199,
          200,
          201,
          202,
          203,
          204,
          205,
          206,
          207,
          208,
          209,
          210,
          211,
          212,
          213,
          214,
          215,
          216,
          217,
          218,
          219,
          220,
          221,
          222,
          223,
          224,
          225,
          226,
          227,
          228,
          229,
          230,
          231,
          232,
          233,
          234,
          235,
          236,
          237,
          238,
          239,
          240,
          241,
          242,
          243,
          244,
          245,
          246,
          247,
          248,
          249,
          250,
          251,
          252,
          253
         ],
         "xaxis": "x",
         "y": [
          107.2473373413086,
          106.28200022379556,
          105.91511111789278,
          105.8679993947347,
          106.04373321533203,
          106.12355465359157,
          105.69876134963262,
          105.17391618092854,
          104.61162849708839,
          104.6504659016927,
          103.14708964029947,
          102.49788708157008,
          101.75317754500952,
          101.37247430710566,
          100.98519778781467,
          100.84933153788249,
          100.83819460401348,
          100.81588759245696,
          100.79908631977283,
          100.78529879252116,
          100.55393180847167,
          100.50076535542806,
          100.4643653869629,
          100.39403228759765,
          100.9166987101237,
          101.4288324991862,
          102.03916562398274,
          102.6929988861084,
          103.3361660003662,
          103.55066591898601,
          104.45049947102866,
          105.43549995422363,
          106.5075668334961,
          107.28956693013508,
          107.99306716918946,
          108.99916712443033,
          109.7660669962565,
          110.45773353576661,
          110.86606725056967,
          111.4912671407064,
          111.95026753743488,
          112.30876731872559,
          113.30126762390137,
          114.1666010538737,
          114.71943473815918,
          115.10633430480955,
          115.93916791280112,
          116.70800120035805,
          117.39133466084797,
          118.33583475748696,
          119.38333511352539,
          119.97233492533367,
          120.85793482462563,
          121.70043462117515,
          122.5244349161784,
          122.84360135396324,
          123.1985346476237,
          123.3970344543457,
          123.86103426615395,
          123.87333399454754,
          124.51300023396809,
          125.53533363342285,
          125.79599990844727,
          126.15483309427896,
          126.04676640828453,
          126.15660018920899,
          125.93226699829101,
          125.69470024108887,
          125.62919985453289,
          125.36869977315268,
          125.38569971720378,
          125.30096651713055,
          124.85329984029133,
          124.608633295695,
          124.50413297017414,
          124.31696662902831,
          124.15679982503256,
          124.06863352457682,
          123.96080017089844,
          124.02113393147788,
          123.5150671641032,
          122.77273406982424,
          122.07596740722656,
          121.1888008117676,
          120.49153378804525,
          119.62503382364909,
          119.09420026143391,
          118.79426740010581,
          118.69210103352864,
          118.10560099283855,
          117.09126726786296,
          116.07666727701822,
          115.1001673380534,
          114.08250071207684,
          113.04900080362957,
          111.96916720072429,
          111.0055009206136,
          110.85666745503742,
          111.32983411153157,
          111.42733395894368,
          111.51033439636231,
          111.22383410135903,
          110.83576736450195,
          110.60530064900715,
          110.30863393147786,
          110.10280024210613,
          109.41146710713704,
          108.32863337198894,
          106.92479960123698,
          106.20163281758626,
          105.47429962158203,
          104.8069995880127,
          104.12116648356121,
          103.3830000559489,
          102.6428332010905,
          101.91266644795736,
          101.25566635131835,
          100.19363314310709,
          98.4099666595459,
          97.00296669006347,
          95.63419952392579,
          94.53303311665852,
          93.60919977823893,
          92.6628328959147,
          91.95349985758463,
          91.18500010172525,
          90.79899991353352,
          90.86316655476888,
          90.9206667582194,
          91.0841667175293,
          91.5641668955485,
          91.75873362223307,
          91.86906661987305,
          92.14923286437988,
          92.47039947509765,
          92.94389966328939,
          93.20603268941244,
          93.2017323811849,
          91.92323226928711,
          90.29909884134928,
          88.59909915924072,
          86.76876576741537,
          84.94793249766033,
          83.19376595815024,
          81.14136594136556,
          79.59536590576172,
          77.54503243764242,
          75.33353252410889,
          73.07303269704184,
          70.50536632537842,
          67.69819952646893,
          65.24109948476156,
          63.09909960428873,
          60.72746658325195,
          58.370800272623704,
          55.977133433024086,
          53.71816692352295,
          51.525667063395176,
          50.573500378926596,
          50.026133664449056,
          49.77746702829997,
          49.53296705881755,
          49.02280050913493,
          48.59546712239583,
          48.26170043945312,
          47.36386706034342,
          46.70706723531087,
          46.247567431132,
          45.892567316691085,
          45.49840043385824,
          45.25296700795492,
          44.97410036722819,
          44.47810039520264,
          44.02890027364095,
          43.46156698862712,
          43.11036707560221,
          42.63403383890788,
          42.06453374226888,
          41.65030040740967,
          41.18446706136068,
          40.52063357035318,
          40.02463347117106,
          39.72696666717529,
          39.51863346099854,
          39.20113353729248,
          38.93463344573975,
          38.538766638437906,
          37.863066514333084,
          37.365466594696045,
          37.129299863179526,
          36.62656666437785,
          36.24559996922811,
          35.825866572062175,
          35.351533253987625,
          34.83903309504191,
          34.22273302078247,
          33.75439955393473,
          33.39306634267171,
          33.001466306050624,
          32.59529978434245,
          32.058966668446864,
          31.87980012893677,
          32.36246678034465,
          32.43063338597616,
          32.58519989649455,
          32.74336652755737,
          32.88336652119954,
          33.02106660207112,
          33.07916653951009,
          32.97833325068156,
          33.062766551971436,
          32.959766483306886,
          32.91999988555908,
          33.02616653442383,
          33.18816661834717,
          33.32916669845581,
          33.39366668065389,
          33.32616669336955,
          33.28050006230672,
          33.20700003306071,
          33.160666624704994,
          32.67899980545044,
          31.582833290100098,
          30.71416657765706,
          29.82676652272542,
          29.009633255004882,
          28.41696669260661,
          27.89963331222534,
          27.43276662826538,
          27.132600084940595,
          26.881333382924403,
          26.80483341217041,
          26.877333386739092,
          26.862933381398523,
          26.912433338165282,
          26.903600056966145,
          27.11846672693888,
          27.29596678415934,
          27.39163344701131,
          27.467300128936767,
          27.68246676127116,
          27.888133557637538,
          27.993300215403234,
          28.127466837565102,
          28.214533583323163,
          28.38166691462199,
          28.450666840871172,
          28.546333408355714,
          28.644533411661786,
          28.513033326466875,
          28.42703336079915,
          28.229866695404052,
          27.806783390045165,
          27.361349995930993
         ],
         "yaxis": "y"
        },
        {
         "line": {
          "color": "#ffd866",
          "width": 1
         },
         "name": "KC Mid",
         "type": "scatter",
         "x": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23,
          24,
          25,
          26,
          27,
          28,
          29,
          30,
          31,
          32,
          33,
          34,
          35,
          36,
          37,
          38,
          39,
          40,
          41,
          42,
          43,
          44,
          45,
          46,
          47,
          48,
          49,
          50,
          51,
          52,
          53,
          54,
          55,
          56,
          57,
          58,
          59,
          60,
          61,
          62,
          63,
          64,
          65,
          66,
          67,
          68,
          69,
          70,
          71,
          72,
          73,
          74,
          75,
          76,
          77,
          78,
          79,
          80,
          81,
          82,
          83,
          84,
          85,
          86,
          87,
          88,
          89,
          90,
          91,
          92,
          93,
          94,
          95,
          96,
          97,
          98,
          99,
          100,
          101,
          102,
          103,
          104,
          105,
          106,
          107,
          108,
          109,
          110,
          111,
          112,
          113,
          114,
          115,
          116,
          117,
          118,
          119,
          120,
          121,
          122,
          123,
          124,
          125,
          126,
          127,
          128,
          129,
          130,
          131,
          132,
          133,
          134,
          135,
          136,
          137,
          138,
          139,
          140,
          141,
          142,
          143,
          144,
          145,
          146,
          147,
          148,
          149,
          150,
          151,
          152,
          153,
          154,
          155,
          156,
          157,
          158,
          159,
          160,
          161,
          162,
          163,
          164,
          165,
          166,
          167,
          168,
          169,
          170,
          171,
          172,
          173,
          174,
          175,
          176,
          177,
          178,
          179,
          180,
          181,
          182,
          183,
          184,
          185,
          186,
          187,
          188,
          189,
          190,
          191,
          192,
          193,
          194,
          195,
          196,
          197,
          198,
          199,
          200,
          201,
          202,
          203,
          204,
          205,
          206,
          207,
          208,
          209,
          210,
          211,
          212,
          213,
          214,
          215,
          216,
          217,
          218,
          219,
          220,
          221,
          222,
          223,
          224,
          225,
          226,
          227,
          228,
          229,
          230,
          231,
          232,
          233,
          234,
          235,
          236,
          237,
          238,
          239,
          240,
          241,
          242,
          243,
          244,
          245,
          246,
          247,
          248,
          249,
          250,
          251,
          252,
          253
         ],
         "xaxis": "x",
         "y": [
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          94.82739969889323,
          94.70083312988281,
          94.65616658528646,
          94.56341667175293,
          94.44258346557618,
          94.64475008646647,
          95.20428339640299,
          95.82811673482259,
          96.48595008850097,
          97.12561683654785,
          97.97276674906414,
          98.96410001118979,
          100.06860008239747,
          101.29711685180663,
          102.25836690266927,
          103.09286689758301,
          103.9195669809977,
          104.77136675516763,
          105.52203330993652,
          106.00136655171711,
          106.61041653951011,
          107.06941655476888,
          107.3879165649414,
          108.06941642761231,
          108.93224970499675,
          109.65008316040038,
          110.15493316650391,
          110.85276654561362,
          111.59634997049969,
          112.39593327840169,
          113.33028322855633,
          114.29078330993653,
          114.99878336588543,
          115.76343332926433,
          116.49593327840171,
          117.17943331400554,
          117.59709981282553,
          117.95663324991862,
          118.28863334655762,
          118.61613337198894,
          118.75708338419595,
          119.09399998982747,
          119.98733329772949,
          120.56399993896484,
          120.76833330790203,
          120.75181668599448,
          120.7671501159668,
          120.53831672668457,
          120.38530006408692,
          120.1585501352946,
          119.90355008443196,
          119.75780016581216,
          119.63586680094402,
          119.36520016988118,
          119.21078364054361,
          118.9937836964925,
          118.81611709594726,
          118.5774503072103,
          118.51428362528483,
          118.59445037841797,
          118.62928365071616,
          118.33551699320476,
          117.68668365478516,
          116.9771671295166,
          116.31700057983399,
          115.73118375142414,
          115.0031836191813,
          114.59335034688313,
          114.25261700948079,
          114.06295026143391,
          113.42345034281414,
          112.57786699930827,
          111.6154669443766,
          110.6139670054118,
          109.68830019632976,
          108.86080004374188,
          107.9617167154948,
          107.07905019124348,
          106.64371693929036,
          106.65588353474934,
          106.69388364156086,
          106.71163368225098,
          106.42613360087077,
          106.11181678771973,
          105.87669995625814,
          105.4970334370931,
          105.25220019022625,
          104.40486691792805,
          103.39703356424968,
          102.2382002512614,
          101.5720334370931,
          100.88170013427734,
          100.18250007629395,
          99.5081667582194,
          98.764000193278,
          97.9858336130778,
          97.26541684468587,
          96.55391693115234,
          95.68543345133463,
          94.35076675415038,
          93.03326683044433,
          91.84420013427734,
          90.8940335591634,
          89.95920015970866,
          89.04298350016276,
          88.30915018717448,
          87.5936503092448,
          87.377650197347,
          87.30781682332358,
          87.34756685892741,
          87.53656692504883,
          87.85606676737467,
          88.01233355204263,
          88.17716674804687,
          88.42183341979981,
          88.84625015258788,
          89.21025021870932,
          89.54628346761068,
          89.55743344624838,
          88.1089334487915,
          86.39049994150797,
          84.61049995422363,
          82.73216660817465,
          80.89183336893718,
          79.11116669972738,
          77.17406667073568,
          75.44531650543213,
          73.46448319753011,
          71.21998329162598,
          68.94173329671224,
          66.39356670379638,
          63.783900133768725,
          61.457000096639,
          59.2845001856486,
          56.9485668182373,
          54.565150133768725,
          52.23448340098063,
          49.967116737365714,
          47.8011168162028,
          47.03945020039876,
          46.59088357289632,
          46.276966921488444,
          45.91196695963542,
          45.38680025736491,
          44.90696690877279,
          44.51990013122558,
          43.78031679789225,
          43.165216763814286,
          42.80746676127116,
          42.392966715494794,
          42.09929993947347,
          41.8608165105184,
          41.57849985758464,
          41.11999988555908,
          40.69909985860188,
          40.224516550699875,
          39.88071657816569,
          39.45913321177165,
          39.023133214314775,
          38.599999809265135,
          38.12966645558675,
          37.57658306757609,
          37.207583014170325,
          36.945416355133055,
          36.74108304977417,
          36.49708318710327,
          36.24008321762085,
          35.83301655451457,
          35.260116513570146,
          34.833716583251956,
          34.22029994328817,
          33.6531166712443,
          33.19459994633992,
          32.711916605631515,
          32.20458329518636,
          31.690333239237468,
          31.100133228302003,
          30.636549917856854,
          30.253216584523518,
          29.903516610463463,
          29.50709997812907,
          29.049766667683922,
          28.804100036621094,
          28.89776674906413,
          28.981433423360194,
          29.105699984232587,
          29.21936664581299,
          29.318866666158037,
          29.46201670964559,
          29.52891667683919,
          29.75733334223429,
          29.92906665802002,
          29.95356664657593,
          29.955749988555908,
          30.04141664505005,
          30.209416675567628,
          30.39491672515869,
          30.44441674550374,
          30.392916742960615,
          30.3172500928243,
          30.246000067392988,
          30.181666723887123,
          29.80675001144409,
          29.184583377838134,
          28.424916680653887,
          27.614816697438556,
          26.890283393859864,
          26.32386671702067,
          25.8235333442688,
          25.399716663360596,
          25.13505007425944,
          24.927483399709065,
          24.831733417510986,
          24.87523339589437,
          24.927433427174883,
          24.969433403015138,
          24.949100049336753,
          25.072916666666664,
          25.190416685740153,
          25.284333356221516,
          25.422000026702882,
          25.634166685740148,
          25.84483340581258,
          25.9285000483195,
          26.00166670481364,
          26.112683359781897,
          26.264716688791907,
          26.370966657002764,
          26.446633338928223,
          26.46528336207072,
          26.33078330357869,
          26.251033337910968,
          26.027116680145262,
          25.657033348083495,
          25.250999959309897
         ],
         "yaxis": "y"
        },
        {
         "line": {
          "color": "#ffd24d",
          "width": 1
         },
         "name": "KC Low",
         "type": "scatter",
         "x": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23,
          24,
          25,
          26,
          27,
          28,
          29,
          30,
          31,
          32,
          33,
          34,
          35,
          36,
          37,
          38,
          39,
          40,
          41,
          42,
          43,
          44,
          45,
          46,
          47,
          48,
          49,
          50,
          51,
          52,
          53,
          54,
          55,
          56,
          57,
          58,
          59,
          60,
          61,
          62,
          63,
          64,
          65,
          66,
          67,
          68,
          69,
          70,
          71,
          72,
          73,
          74,
          75,
          76,
          77,
          78,
          79,
          80,
          81,
          82,
          83,
          84,
          85,
          86,
          87,
          88,
          89,
          90,
          91,
          92,
          93,
          94,
          95,
          96,
          97,
          98,
          99,
          100,
          101,
          102,
          103,
          104,
          105,
          106,
          107,
          108,
          109,
          110,
          111,
          112,
          113,
          114,
          115,
          116,
          117,
          118,
          119,
          120,
          121,
          122,
          123,
          124,
          125,
          126,
          127,
          128,
          129,
          130,
          131,
          132,
          133,
          134,
          135,
          136,
          137,
          138,
          139,
          140,
          141,
          142,
          143,
          144,
          145,
          146,
          147,
          148,
          149,
          150,
          151,
          152,
          153,
          154,
          155,
          156,
          157,
          158,
          159,
          160,
          161,
          162,
          163,
          164,
          165,
          166,
          167,
          168,
          169,
          170,
          171,
          172,
          173,
          174,
          175,
          176,
          177,
          178,
          179,
          180,
          181,
          182,
          183,
          184,
          185,
          186,
          187,
          188,
          189,
          190,
          191,
          192,
          193,
          194,
          195,
          196,
          197,
          198,
          199,
          200,
          201,
          202,
          203,
          204,
          205,
          206,
          207,
          208,
          209,
          210,
          211,
          212,
          213,
          214,
          215,
          216,
          217,
          218,
          219,
          220,
          221,
          222,
          223,
          224,
          225,
          226,
          227,
          228,
          229,
          230,
          231,
          232,
          233,
          234,
          235,
          236,
          237,
          238,
          239,
          240,
          241,
          242,
          243,
          244,
          245,
          246,
          247,
          248,
          249,
          250,
          251,
          252,
          253
         ],
         "xaxis": "x",
         "y": [
          97.15532684326172,
          97.38599650065103,
          98.07577599419487,
          98.47349866231282,
          98.48013153076172,
          97.52155473497179,
          97.13990384056454,
          96.55741532643636,
          95.94140653257017,
          93.36926625569662,
          92.00054561730587,
          90.76188956366644,
          89.81071843856421,
          89.17590513683501,
          88.79106733534071,
          88.78958384195964,
          88.91137306362975,
          88.71388936925818,
          88.77614111649363,
          88.8695006052653,
          88.84773445129395,
          88.81156781514485,
          88.66246795654297,
          88.49113464355469,
          88.37280146280924,
          88.97973429361979,
          89.61706784566243,
          90.27890129089356,
          90.91506767272949,
          92.39486757914226,
          93.47770055135092,
          94.70170021057129,
          96.08666687011718,
          97.22716687520344,
          98.19266662597656,
          98.8399668375651,
          99.77666651407877,
          100.58633308410644,
          101.13666585286458,
          101.72956593831381,
          102.18856557210287,
          102.46706581115723,
          102.83756523132324,
          103.6978983561198,
          104.5807315826416,
          105.20353202819824,
          105.76636517842613,
          106.48469874064128,
          107.4005318959554,
          108.32473169962566,
          109.19823150634765,
          110.02523180643718,
          110.668931833903,
          111.29143193562827,
          111.83443171183269,
          112.35059827168784,
          112.71473185221355,
          113.18023223876953,
          113.3712324778239,
          113.64083277384438,
          113.67499974568685,
          114.43933296203613,
          115.33199996948242,
          115.38183352152507,
          115.45686696370444,
          115.37770004272461,
          115.14436645507813,
          115.07589988708496,
          114.68790041605632,
          114.43840039571126,
          114.12990061442056,
          113.9707670847575,
          113.87710049947103,
          113.81293398539223,
          113.48343442281086,
          113.31526756286621,
          112.99810078938803,
          112.95993372599284,
          113.2281005859375,
          113.23743336995445,
          113.15596682230633,
          112.60063323974609,
          111.87836685180665,
          111.4452003479004,
          110.97083371480305,
          110.38133341471352,
          110.09250043233234,
          109.71096661885579,
          109.43379948933918,
          108.74129969278972,
          108.0644667307536,
          107.15426661173504,
          106.12776667277019,
          105.29409968058269,
          104.67259928385417,
          103.9542662302653,
          103.15259946187336,
          102.43076642354329,
          101.98193295796713,
          101.96043332417807,
          101.91293296813964,
          101.6284331003825,
          101.3878662109375,
          101.14809926350912,
          100.68543294270833,
          100.40160013834635,
          99.39826672871908,
          98.46543375651041,
          97.55160090128581,
          96.94243405659994,
          96.28910064697266,
          95.5580005645752,
          94.89516703287761,
          94.14500033060709,
          93.3288340250651,
          92.6181672414144,
          91.85216751098633,
          91.17723375956217,
          90.29156684875488,
          89.06356697082519,
          88.0542007446289,
          87.25503400166829,
          86.30920054117838,
          85.4231341044108,
          84.66480051676432,
          84.00230051676432,
          83.95630048116047,
          83.75246709187826,
          83.77446695963542,
          83.98896713256836,
          84.14796663920085,
          84.26593348185222,
          84.4852668762207,
          84.69443397521972,
          85.22210083007812,
          85.47660077412924,
          85.88653424580892,
          85.91313451131185,
          84.2946346282959,
          82.48190104166666,
          80.62190074920655,
          78.69556744893393,
          76.83573424021404,
          75.02856744130453,
          73.2067674001058,
          71.29526710510254,
          69.38393395741781,
          67.10643405914307,
          64.81043389638265,
          62.28176708221436,
          59.86960074106853,
          57.672900708516444,
          55.46990076700846,
          53.16966705322265,
          50.75949999491373,
          48.49183336893718,
          46.21606655120849,
          44.07656656901042,
          43.505400021870926,
          43.155633481343585,
          42.77646681467692,
          42.29096686045329,
          41.75080000559489,
          41.218466695149736,
          40.778099822998044,
          40.19676653544108,
          39.623366292317705,
          39.36736609141032,
          38.8933661142985,
          38.7001994450887,
          38.46866601308187,
          38.18289934794108,
          37.761899375915526,
          37.369299443562824,
          36.98746611277262,
          36.651066080729166,
          36.28423258463542,
          35.98173268636067,
          35.549699211120604,
          35.074865849812824,
          34.632532564798986,
          34.39053255716959,
          34.16386604309082,
          33.96353263854981,
          33.793032836914065,
          33.54553298950195,
          33.12726647059123,
          32.65716651280721,
          32.30196657180786,
          31.311300023396814,
          30.679666678110756,
          30.143599923451738,
          29.59796663920085,
          29.057633336385088,
          28.541633383433027,
          27.977533435821535,
          27.518700281778973,
          27.113366826375323,
          26.8055669148763,
          26.41890017191569,
          26.040566666920977,
          25.72839994430542,
          25.43306671778361,
          25.53223346074422,
          25.62620007197062,
          25.695366764068602,
          25.754366811116533,
          25.90296681722005,
          25.9786668141683,
          26.53633343378703,
          26.795366764068604,
          26.947366809844972,
          26.991500091552734,
          27.056666755676268,
          27.230666732788087,
          27.460666751861574,
          27.495166810353602,
          27.45966679255168,
          27.354000123341883,
          27.285000101725256,
          27.202666823069258,
          26.934500217437744,
          26.78633346557617,
          26.13566678365072,
          25.402866872151694,
          24.770933532714842,
          24.23076674143473,
          23.747433376312255,
          23.36666669845581,
          23.137500063578287,
          22.973633416493733,
          22.85863342285156,
          22.873133405049643,
          22.991933472951253,
          23.02643346786499,
          22.994600041707358,
          23.027366606394448,
          23.084866587320963,
          23.177033265431724,
          23.376699924468994,
          23.585866610209145,
          23.80153325398763,
          23.86369988123576,
          23.875866572062172,
          24.01083313624064,
          24.147766462961833,
          24.29126647313436,
          24.34693326950073,
          24.286033312479653,
          24.14853328069051,
          24.075033315022786,
          23.824366664886476,
          23.507283306121828,
          23.1406499226888
         ],
         "yaxis": "y"
        },
        {
         "marker": {
          "color": "green",
          "symbol": "arrow-up"
         },
         "mode": "markers",
         "name": "Buy",
         "type": "scatter",
         "x": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23,
          24,
          25,
          26,
          27,
          28,
          29,
          30,
          31,
          32,
          33,
          34,
          35,
          36,
          37,
          38,
          39,
          40,
          41,
          42,
          43,
          44,
          45,
          46,
          47,
          48,
          49,
          50,
          51,
          52,
          53,
          54,
          55,
          56,
          57,
          58,
          59,
          60,
          61,
          62,
          63,
          64,
          65,
          66,
          67,
          68,
          69,
          70,
          71,
          72,
          73,
          74,
          75,
          76,
          77,
          78,
          79,
          80,
          81,
          82,
          83,
          84,
          85,
          86,
          87,
          88,
          89,
          90,
          91,
          92,
          93,
          94,
          95,
          96,
          97,
          98,
          99,
          100,
          101,
          102,
          103,
          104,
          105,
          106,
          107,
          108,
          109,
          110,
          111,
          112,
          113,
          114,
          115,
          116,
          117,
          118,
          119,
          120,
          121,
          122,
          123,
          124,
          125,
          126,
          127,
          128,
          129,
          130,
          131,
          132,
          133,
          134,
          135,
          136,
          137,
          138,
          139,
          140,
          141,
          142,
          143,
          144,
          145,
          146,
          147,
          148,
          149,
          150,
          151,
          152,
          153,
          154,
          155,
          156,
          157,
          158,
          159,
          160,
          161,
          162,
          163,
          164,
          165,
          166,
          167,
          168,
          169,
          170,
          171,
          172,
          173,
          174,
          175,
          176,
          177,
          178,
          179,
          180,
          181,
          182,
          183,
          184,
          185,
          186,
          187,
          188,
          189,
          190,
          191,
          192,
          193,
          194,
          195,
          196,
          197,
          198,
          199,
          200,
          201,
          202,
          203,
          204,
          205,
          206,
          207,
          208,
          209,
          210,
          211,
          212,
          213,
          214,
          215,
          216,
          217,
          218,
          219,
          220,
          221,
          222,
          223,
          224,
          225,
          226,
          227,
          228,
          229,
          230,
          231,
          232,
          233,
          234,
          235,
          236,
          237,
          238,
          239,
          240,
          241,
          242,
          243,
          244,
          245,
          246,
          247,
          248,
          249,
          250,
          251,
          252,
          253
         ],
         "y": [
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          100.9000015258789,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          117.16999816894531,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          126.3499984741211,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          114.38999938964844,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          94.83000183105469,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          37.27000045776367,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          27.530000686645508,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null
         ]
        },
        {
         "marker": {
          "color": "red",
          "symbol": "arrow-down"
         },
         "mode": "markers",
         "name": "Sell",
         "type": "scatter",
         "x": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23,
          24,
          25,
          26,
          27,
          28,
          29,
          30,
          31,
          32,
          33,
          34,
          35,
          36,
          37,
          38,
          39,
          40,
          41,
          42,
          43,
          44,
          45,
          46,
          47,
          48,
          49,
          50,
          51,
          52,
          53,
          54,
          55,
          56,
          57,
          58,
          59,
          60,
          61,
          62,
          63,
          64,
          65,
          66,
          67,
          68,
          69,
          70,
          71,
          72,
          73,
          74,
          75,
          76,
          77,
          78,
          79,
          80,
          81,
          82,
          83,
          84,
          85,
          86,
          87,
          88,
          89,
          90,
          91,
          92,
          93,
          94,
          95,
          96,
          97,
          98,
          99,
          100,
          101,
          102,
          103,
          104,
          105,
          106,
          107,
          108,
          109,
          110,
          111,
          112,
          113,
          114,
          115,
          116,
          117,
          118,
          119,
          120,
          121,
          122,
          123,
          124,
          125,
          126,
          127,
          128,
          129,
          130,
          131,
          132,
          133,
          134,
          135,
          136,
          137,
          138,
          139,
          140,
          141,
          142,
          143,
          144,
          145,
          146,
          147,
          148,
          149,
          150,
          151,
          152,
          153,
          154,
          155,
          156,
          157,
          158,
          159,
          160,
          161,
          162,
          163,
          164,
          165,
          166,
          167,
          168,
          169,
          170,
          171,
          172,
          173,
          174,
          175,
          176,
          177,
          178,
          179,
          180,
          181,
          182,
          183,
          184,
          185,
          186,
          187,
          188,
          189,
          190,
          191,
          192,
          193,
          194,
          195,
          196,
          197,
          198,
          199,
          200,
          201,
          202,
          203,
          204,
          205,
          206,
          207,
          208,
          209,
          210,
          211,
          212,
          213,
          214,
          215,
          216,
          217,
          218,
          219,
          220,
          221,
          222,
          223,
          224,
          225,
          226,
          227,
          228,
          229,
          230,
          231,
          232,
          233,
          234,
          235,
          236,
          237,
          238,
          239,
          240,
          241,
          242,
          243,
          244,
          245,
          246,
          247,
          248,
          249,
          250,
          251,
          252,
          253
         ],
         "y": [
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          105.06999969482422,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          113.36000061035156,
          null,
          null,
          null,
          null,
          null,
          119.66999816894531,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          105.55999755859375,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          86.05999755859375,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          29.6299991607666,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          24.90999984741211,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null,
          null
         ]
        }
       ],
       "layout": {
        "autosize": false,
        "height": 600,
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "title": {
         "text": "Keltner Channel",
         "x": 0.5
        },
        "width": 900,
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ]
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ]
        }
       }
      },
      "text/html": [
       "<div>                            <div id=\"d4818610-7249-4f54-a3bd-e848d3f20af8\" class=\"plotly-graph-div\" style=\"height:600px; width:900px;\"></div>            <script type=\"text/javascript\">                require([\"plotly\"], function(Plotly) {                    window.PLOTLYENV=window.PLOTLYENV || {};                                    if (document.getElementById(\"d4818610-7249-4f54-a3bd-e848d3f20af8\")) {                    Plotly.newPlot(                        \"d4818610-7249-4f54-a3bd-e848d3f20af8\",                        [{\"line\":{\"color\":\"blue\",\"width\":1},\"name\":\"Close\",\"x\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253],\"y\":[101.48999786376953,101.06999969482422,103.2699966430664,102.33999633789062,103.22000122070312,98.9000015258789,98.3499984741211,95.83999633789062,96.69999694824219,82.62000274658203,83.77999877929688,83.80999755859375,87.48999786376953,91.01000213623047,89.3499984741211,95.29000091552734,96.58000183105469,92.29000091552734,95.19000244140625,96.55000305175781,100.45999908447266,100.9000015258789,101.16000366210938,99.44000244140625,109.55999755859375,112.5999984741211,110.30999755859375,108.88999938964844,108.55000305175781,103.0999984741211,103.01000213623047,109.79000091552734,109.69000244140625,106.97000122070312,106.08000183105469,113.12000274658203,112.08999633789062,106.11000061035156,105.06999969482422,108.80999755859375,109.12000274658203,108.11000061035156,117.16999816894531,117.4800033569336,121.8499984741211,121.48999786376953,126.91999816894531,125.68000030517578,124.0199966430664,122.16000366210938,121.5999984741211,123.69000244140625,123.51000213623047,124.05999755859375,117.83999633789062,120.30999755859375,119.8499984741211,113.36000061035156,111.19000244140625,110.54000091552734,118.43000030517578,126.3499984741211,126.43000030517578,119.66999816894531,121.55000305175781,122.68000030517578,121.36000061035156,121.91999816894531,118.0999984741211,118.05000305175781,120.69000244140625,119.2699966430664,120.93000030517578,120.22000122070312,112.69000244140625,116.58000183105469,113.83999633789062,112.94999694824219,112.63999938964844,110.87999725341797,110.0,113.25,110.6500015258789,107.80000305175781,108.06999969482422,106.58999633789062,113.70999908447266,116.25,114.08999633789062,104.33999633789062,101.4800033569336,100.19000244140625,100.04000091552734,101.0,98.55999755859375,96.4800033569336,97.5,107.08000183105469,114.38999938964844,111.51000213623047,108.5,105.55999755859375,104.91999816894531,103.41999816894531,100.7300033569336,100.91999816894531,94.55000305175781,94.37999725341797,92.63999938964844,92.06999969482422,87.80000305175781,85.4000015258789,87.05000305175781,86.70999908447266,82.3499984741211,82.55999755859375,83.76000213623047,87.73999786376953,86.11000061035156,84.87000274658203,86.6500015258789,86.70999908447266,85.8499984741211,85.11000061035156,87.6500015258789,88.19000244140625,90.6500015258789,94.83000183105469,93.83000183105469,96.5999984741211,93.45999908447266,88.44999694824219,90.30999755859375,91.44000244140625,92.83000183105469,89.37000274658203,89.9000015258789,86.05999755859375,55.63999938964844,51.25,50.130001068115234,48.95000076293945,50.52000045776367,49.220001220703125,47.4900016784668,54.849998474121094,51.130001068115234,48.400001525878906,47.13999938964844,44.08000183105469,42.970001220703125,43.91999816894531,46.40999984741211,44.38999938964844,44.0,42.25,44.45000076293945,43.54999923706055,42.4900016784668,41.779998779296875,45.90999984741211,40.70000076293945,38.5099983215332,41.34000015258789,39.2599983215332,38.5,39.810001373291016,42.45000076293945,38.70000076293945,39.189998626708984,37.779998779296875,38.59000015258789,36.709999084472656,35.130001068115234,34.560001373291016,37.189998626708984,35.7599983215332,35.20000076293945,33.81999969482422,32.22999954223633,33.86000061035156,35.58000183105469,34.369998931884766,36.560001373291016,34.4900016784668,32.150001525878906,31.329999923706055,30.229999542236328,31.84000015258789,24.219999313354492,27.059999465942383,29.709999084472656,26.530000686645508,24.75,23.969999313354492,25.639999389648438,27.329999923706055,28.020000457763672,26.700000762939453,24.25,24.600000381469727,29.75,37.27000045776367,38.77000045776367,37.459999084472656,34.68000030517578,32.83000183105469,33.25,32.04999923706055,30.59000015258789,29.6299991607666,28.549999237060547,27.0,28.299999237060547,28.190000534057617,29.059999465942383,27.6200008392334,26.729999542236328,24.520000457763672,23.489999771118164,22.520000457763672,22.549999237060547,23.440000534057617,22.610000610351562,21.139999389648438,20.200000762939453,22.610000610351562,23.309999465942383,24.700000762939453,26.6200008392334,26.25,27.530000686645508,28.709999084472656,28.940000534057617,28.420000076293945,28.06999969482422,30.889999389648438,28.440000534057617,26.420000076293945,26.309999465942383,27.809999465942383,26.200000762939453,24.90999984741211,24.059999465942383,23.559999465942383,24.18000030517578,23.709999084472656,25.030000686645508,23.8700008392334,23.90999984741211,24.530000686645508,21.770000457763672,20.46500015258789,20.389999389648438],\"type\":\"scatter\",\"xaxis\":\"x\",\"yaxis\":\"y\"},{\"line\":{\"color\":\"#ffdf80\",\"width\":1},\"name\":\"KC High\",\"x\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253],\"y\":[107.2473373413086,106.28200022379556,105.91511111789278,105.8679993947347,106.04373321533203,106.12355465359157,105.69876134963262,105.17391618092854,104.61162849708839,104.6504659016927,103.14708964029947,102.49788708157008,101.75317754500952,101.37247430710566,100.98519778781467,100.84933153788249,100.83819460401348,100.81588759245696,100.79908631977283,100.78529879252116,100.55393180847167,100.50076535542806,100.4643653869629,100.39403228759765,100.9166987101237,101.4288324991862,102.03916562398274,102.6929988861084,103.3361660003662,103.55066591898601,104.45049947102866,105.43549995422363,106.5075668334961,107.28956693013508,107.99306716918946,108.99916712443033,109.7660669962565,110.45773353576661,110.86606725056967,111.4912671407064,111.95026753743488,112.30876731872559,113.30126762390137,114.1666010538737,114.71943473815918,115.10633430480955,115.93916791280112,116.70800120035805,117.39133466084797,118.33583475748696,119.38333511352539,119.97233492533367,120.85793482462563,121.70043462117515,122.5244349161784,122.84360135396324,123.1985346476237,123.3970344543457,123.86103426615395,123.87333399454754,124.51300023396809,125.53533363342285,125.79599990844727,126.15483309427896,126.04676640828453,126.15660018920899,125.93226699829101,125.69470024108887,125.62919985453289,125.36869977315268,125.38569971720378,125.30096651713055,124.85329984029133,124.608633295695,124.50413297017414,124.31696662902831,124.15679982503256,124.06863352457682,123.96080017089844,124.02113393147788,123.5150671641032,122.77273406982424,122.07596740722656,121.1888008117676,120.49153378804525,119.62503382364909,119.09420026143391,118.79426740010581,118.69210103352864,118.10560099283855,117.09126726786296,116.07666727701822,115.1001673380534,114.08250071207684,113.04900080362957,111.96916720072429,111.0055009206136,110.85666745503742,111.32983411153157,111.42733395894368,111.51033439636231,111.22383410135903,110.83576736450195,110.60530064900715,110.30863393147786,110.10280024210613,109.41146710713704,108.32863337198894,106.92479960123698,106.20163281758626,105.47429962158203,104.8069995880127,104.12116648356121,103.3830000559489,102.6428332010905,101.91266644795736,101.25566635131835,100.19363314310709,98.4099666595459,97.00296669006347,95.63419952392579,94.53303311665852,93.60919977823893,92.6628328959147,91.95349985758463,91.18500010172525,90.79899991353352,90.86316655476888,90.9206667582194,91.0841667175293,91.5641668955485,91.75873362223307,91.86906661987305,92.14923286437988,92.47039947509765,92.94389966328939,93.20603268941244,93.2017323811849,91.92323226928711,90.29909884134928,88.59909915924072,86.76876576741537,84.94793249766033,83.19376595815024,81.14136594136556,79.59536590576172,77.54503243764242,75.33353252410889,73.07303269704184,70.50536632537842,67.69819952646893,65.24109948476156,63.09909960428873,60.72746658325195,58.370800272623704,55.977133433024086,53.71816692352295,51.525667063395176,50.573500378926596,50.026133664449056,49.77746702829997,49.53296705881755,49.02280050913493,48.59546712239583,48.26170043945312,47.36386706034342,46.70706723531087,46.247567431132,45.892567316691085,45.49840043385824,45.25296700795492,44.97410036722819,44.47810039520264,44.02890027364095,43.46156698862712,43.11036707560221,42.63403383890788,42.06453374226888,41.65030040740967,41.18446706136068,40.52063357035318,40.02463347117106,39.72696666717529,39.51863346099854,39.20113353729248,38.93463344573975,38.538766638437906,37.863066514333084,37.365466594696045,37.129299863179526,36.62656666437785,36.24559996922811,35.825866572062175,35.351533253987625,34.83903309504191,34.22273302078247,33.75439955393473,33.39306634267171,33.001466306050624,32.59529978434245,32.058966668446864,31.87980012893677,32.36246678034465,32.43063338597616,32.58519989649455,32.74336652755737,32.88336652119954,33.02106660207112,33.07916653951009,32.97833325068156,33.062766551971436,32.959766483306886,32.91999988555908,33.02616653442383,33.18816661834717,33.32916669845581,33.39366668065389,33.32616669336955,33.28050006230672,33.20700003306071,33.160666624704994,32.67899980545044,31.582833290100098,30.71416657765706,29.82676652272542,29.009633255004882,28.41696669260661,27.89963331222534,27.43276662826538,27.132600084940595,26.881333382924403,26.80483341217041,26.877333386739092,26.862933381398523,26.912433338165282,26.903600056966145,27.11846672693888,27.29596678415934,27.39163344701131,27.467300128936767,27.68246676127116,27.888133557637538,27.993300215403234,28.127466837565102,28.214533583323163,28.38166691462199,28.450666840871172,28.546333408355714,28.644533411661786,28.513033326466875,28.42703336079915,28.229866695404052,27.806783390045165,27.361349995930993],\"type\":\"scatter\",\"xaxis\":\"x\",\"yaxis\":\"y\"},{\"line\":{\"color\":\"#ffd866\",\"width\":1},\"name\":\"KC Mid\",\"x\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253],\"y\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,94.82739969889323,94.70083312988281,94.65616658528646,94.56341667175293,94.44258346557618,94.64475008646647,95.20428339640299,95.82811673482259,96.48595008850097,97.12561683654785,97.97276674906414,98.96410001118979,100.06860008239747,101.29711685180663,102.25836690266927,103.09286689758301,103.9195669809977,104.77136675516763,105.52203330993652,106.00136655171711,106.61041653951011,107.06941655476888,107.3879165649414,108.06941642761231,108.93224970499675,109.65008316040038,110.15493316650391,110.85276654561362,111.59634997049969,112.39593327840169,113.33028322855633,114.29078330993653,114.99878336588543,115.76343332926433,116.49593327840171,117.17943331400554,117.59709981282553,117.95663324991862,118.28863334655762,118.61613337198894,118.75708338419595,119.09399998982747,119.98733329772949,120.56399993896484,120.76833330790203,120.75181668599448,120.7671501159668,120.53831672668457,120.38530006408692,120.1585501352946,119.90355008443196,119.75780016581216,119.63586680094402,119.36520016988118,119.21078364054361,118.9937836964925,118.81611709594726,118.5774503072103,118.51428362528483,118.59445037841797,118.62928365071616,118.33551699320476,117.68668365478516,116.9771671295166,116.31700057983399,115.73118375142414,115.0031836191813,114.59335034688313,114.25261700948079,114.06295026143391,113.42345034281414,112.57786699930827,111.6154669443766,110.6139670054118,109.68830019632976,108.86080004374188,107.9617167154948,107.07905019124348,106.64371693929036,106.65588353474934,106.69388364156086,106.71163368225098,106.42613360087077,106.11181678771973,105.87669995625814,105.4970334370931,105.25220019022625,104.40486691792805,103.39703356424968,102.2382002512614,101.5720334370931,100.88170013427734,100.18250007629395,99.5081667582194,98.764000193278,97.9858336130778,97.26541684468587,96.55391693115234,95.68543345133463,94.35076675415038,93.03326683044433,91.84420013427734,90.8940335591634,89.95920015970866,89.04298350016276,88.30915018717448,87.5936503092448,87.377650197347,87.30781682332358,87.34756685892741,87.53656692504883,87.85606676737467,88.01233355204263,88.17716674804687,88.42183341979981,88.84625015258788,89.21025021870932,89.54628346761068,89.55743344624838,88.1089334487915,86.39049994150797,84.61049995422363,82.73216660817465,80.89183336893718,79.11116669972738,77.17406667073568,75.44531650543213,73.46448319753011,71.21998329162598,68.94173329671224,66.39356670379638,63.783900133768725,61.457000096639,59.2845001856486,56.9485668182373,54.565150133768725,52.23448340098063,49.967116737365714,47.8011168162028,47.03945020039876,46.59088357289632,46.276966921488444,45.91196695963542,45.38680025736491,44.90696690877279,44.51990013122558,43.78031679789225,43.165216763814286,42.80746676127116,42.392966715494794,42.09929993947347,41.8608165105184,41.57849985758464,41.11999988555908,40.69909985860188,40.224516550699875,39.88071657816569,39.45913321177165,39.023133214314775,38.599999809265135,38.12966645558675,37.57658306757609,37.207583014170325,36.945416355133055,36.74108304977417,36.49708318710327,36.24008321762085,35.83301655451457,35.260116513570146,34.833716583251956,34.22029994328817,33.6531166712443,33.19459994633992,32.711916605631515,32.20458329518636,31.690333239237468,31.100133228302003,30.636549917856854,30.253216584523518,29.903516610463463,29.50709997812907,29.049766667683922,28.804100036621094,28.89776674906413,28.981433423360194,29.105699984232587,29.21936664581299,29.318866666158037,29.46201670964559,29.52891667683919,29.75733334223429,29.92906665802002,29.95356664657593,29.955749988555908,30.04141664505005,30.209416675567628,30.39491672515869,30.44441674550374,30.392916742960615,30.3172500928243,30.246000067392988,30.181666723887123,29.80675001144409,29.184583377838134,28.424916680653887,27.614816697438556,26.890283393859864,26.32386671702067,25.8235333442688,25.399716663360596,25.13505007425944,24.927483399709065,24.831733417510986,24.87523339589437,24.927433427174883,24.969433403015138,24.949100049336753,25.072916666666664,25.190416685740153,25.284333356221516,25.422000026702882,25.634166685740148,25.84483340581258,25.9285000483195,26.00166670481364,26.112683359781897,26.264716688791907,26.370966657002764,26.446633338928223,26.46528336207072,26.33078330357869,26.251033337910968,26.027116680145262,25.657033348083495,25.250999959309897],\"type\":\"scatter\",\"xaxis\":\"x\",\"yaxis\":\"y\"},{\"line\":{\"color\":\"#ffd24d\",\"width\":1},\"name\":\"KC Low\",\"x\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253],\"y\":[97.15532684326172,97.38599650065103,98.07577599419487,98.47349866231282,98.48013153076172,97.52155473497179,97.13990384056454,96.55741532643636,95.94140653257017,93.36926625569662,92.00054561730587,90.76188956366644,89.81071843856421,89.17590513683501,88.79106733534071,88.78958384195964,88.91137306362975,88.71388936925818,88.77614111649363,88.8695006052653,88.84773445129395,88.81156781514485,88.66246795654297,88.49113464355469,88.37280146280924,88.97973429361979,89.61706784566243,90.27890129089356,90.91506767272949,92.39486757914226,93.47770055135092,94.70170021057129,96.08666687011718,97.22716687520344,98.19266662597656,98.8399668375651,99.77666651407877,100.58633308410644,101.13666585286458,101.72956593831381,102.18856557210287,102.46706581115723,102.83756523132324,103.6978983561198,104.5807315826416,105.20353202819824,105.76636517842613,106.48469874064128,107.4005318959554,108.32473169962566,109.19823150634765,110.02523180643718,110.668931833903,111.29143193562827,111.83443171183269,112.35059827168784,112.71473185221355,113.18023223876953,113.3712324778239,113.64083277384438,113.67499974568685,114.43933296203613,115.33199996948242,115.38183352152507,115.45686696370444,115.37770004272461,115.14436645507813,115.07589988708496,114.68790041605632,114.43840039571126,114.12990061442056,113.9707670847575,113.87710049947103,113.81293398539223,113.48343442281086,113.31526756286621,112.99810078938803,112.95993372599284,113.2281005859375,113.23743336995445,113.15596682230633,112.60063323974609,111.87836685180665,111.4452003479004,110.97083371480305,110.38133341471352,110.09250043233234,109.71096661885579,109.43379948933918,108.74129969278972,108.0644667307536,107.15426661173504,106.12776667277019,105.29409968058269,104.67259928385417,103.9542662302653,103.15259946187336,102.43076642354329,101.98193295796713,101.96043332417807,101.91293296813964,101.6284331003825,101.3878662109375,101.14809926350912,100.68543294270833,100.40160013834635,99.39826672871908,98.46543375651041,97.55160090128581,96.94243405659994,96.28910064697266,95.5580005645752,94.89516703287761,94.14500033060709,93.3288340250651,92.6181672414144,91.85216751098633,91.17723375956217,90.29156684875488,89.06356697082519,88.0542007446289,87.25503400166829,86.30920054117838,85.4231341044108,84.66480051676432,84.00230051676432,83.95630048116047,83.75246709187826,83.77446695963542,83.98896713256836,84.14796663920085,84.26593348185222,84.4852668762207,84.69443397521972,85.22210083007812,85.47660077412924,85.88653424580892,85.91313451131185,84.2946346282959,82.48190104166666,80.62190074920655,78.69556744893393,76.83573424021404,75.02856744130453,73.2067674001058,71.29526710510254,69.38393395741781,67.10643405914307,64.81043389638265,62.28176708221436,59.86960074106853,57.672900708516444,55.46990076700846,53.16966705322265,50.75949999491373,48.49183336893718,46.21606655120849,44.07656656901042,43.505400021870926,43.155633481343585,42.77646681467692,42.29096686045329,41.75080000559489,41.218466695149736,40.778099822998044,40.19676653544108,39.623366292317705,39.36736609141032,38.8933661142985,38.7001994450887,38.46866601308187,38.18289934794108,37.761899375915526,37.369299443562824,36.98746611277262,36.651066080729166,36.28423258463542,35.98173268636067,35.549699211120604,35.074865849812824,34.632532564798986,34.39053255716959,34.16386604309082,33.96353263854981,33.793032836914065,33.54553298950195,33.12726647059123,32.65716651280721,32.30196657180786,31.311300023396814,30.679666678110756,30.143599923451738,29.59796663920085,29.057633336385088,28.541633383433027,27.977533435821535,27.518700281778973,27.113366826375323,26.8055669148763,26.41890017191569,26.040566666920977,25.72839994430542,25.43306671778361,25.53223346074422,25.62620007197062,25.695366764068602,25.754366811116533,25.90296681722005,25.9786668141683,26.53633343378703,26.795366764068604,26.947366809844972,26.991500091552734,27.056666755676268,27.230666732788087,27.460666751861574,27.495166810353602,27.45966679255168,27.354000123341883,27.285000101725256,27.202666823069258,26.934500217437744,26.78633346557617,26.13566678365072,25.402866872151694,24.770933532714842,24.23076674143473,23.747433376312255,23.36666669845581,23.137500063578287,22.973633416493733,22.85863342285156,22.873133405049643,22.991933472951253,23.02643346786499,22.994600041707358,23.027366606394448,23.084866587320963,23.177033265431724,23.376699924468994,23.585866610209145,23.80153325398763,23.86369988123576,23.875866572062172,24.01083313624064,24.147766462961833,24.29126647313436,24.34693326950073,24.286033312479653,24.14853328069051,24.075033315022786,23.824366664886476,23.507283306121828,23.1406499226888],\"type\":\"scatter\",\"xaxis\":\"x\",\"yaxis\":\"y\"},{\"marker\":{\"color\":\"green\",\"symbol\":\"arrow-up\"},\"mode\":\"markers\",\"name\":\"Buy\",\"x\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253],\"y\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,100.9000015258789,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,117.16999816894531,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,126.3499984741211,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,114.38999938964844,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,94.83000183105469,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,37.27000045776367,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,27.530000686645508,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],\"type\":\"scatter\"},{\"marker\":{\"color\":\"red\",\"symbol\":\"arrow-down\"},\"mode\":\"markers\",\"name\":\"Sell\",\"x\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253],\"y\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,105.06999969482422,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,113.36000061035156,null,null,null,null,null,119.66999816894531,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,105.55999755859375,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,86.05999755859375,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,29.6299991607666,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,24.90999984741211,null,null,null,null,null,null,null,null,null,null,null],\"type\":\"scatter\"}],                        {\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#EBF0F8\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"#C8D4E3\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#2a3f5f\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"#E5ECF6\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"light\"},\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"#E5ECF6\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"line\":{\"color\":\"#2a3f5f\"}},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2}}},\"xaxis\":{\"anchor\":\"y\",\"domain\":[0.0,1.0]},\"yaxis\":{\"anchor\":\"x\",\"domain\":[0.0,1.0]},\"title\":{\"text\":\"Keltner Channel\",\"x\":0.5},\"autosize\":false,\"width\":900,\"height\":600},                        {\"responsive\": true}                    ).then(function(){\n",
       "                            \n",
       "var gd = document.getElementById('d4818610-7249-4f54-a3bd-e848d3f20af8');\n",
       "var x = new MutationObserver(function (mutations, observer) {{\n",
       "        var display = window.getComputedStyle(gd).display;\n",
       "        if (!display || display === 'none') {{\n",
       "            console.log([gd, 'removed!']);\n",
       "            Plotly.purge(gd);\n",
       "            observer.disconnect();\n",
       "        }}\n",
       "}});\n",
       "\n",
       "// Listen for the removal of the full notebook cells\n",
       "var notebookContainer = gd.closest('#notebook-container');\n",
       "if (notebookContainer) {{\n",
       "    x.observe(notebookContainer, {childList: true});\n",
       "}}\n",
       "\n",
       "// Listen for the clearing of the current output cell\n",
       "var outputEl = gd.closest('.output');\n",
       "if (outputEl) {{\n",
       "    x.observe(outputEl, {childList: true});\n",
       "}}\n",
       "\n",
       "                        })                };                });            </script>        </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#  Perform analysis\n",
    "investment = 1000\n",
    "df = load_historic_data('PTON')\n",
    "df.reset_index(inplace=True)\n",
    "df = calculate_keltner_channels(df)\n",
    "df = apply_strategy_rules(df)\n",
    "entry_prices, exit_prices = execute_strategy(df)\n",
    "profit_or_loss = calculate_strategy_profit(investment, entry_prices, exit_prices)\n",
    "buy_hold_profit = calculate_buy_hold_profit(investment, df)\n",
    "plot_graph(df, entry_prices, exit_prices)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "id": "8afde903",
   "metadata": {},
   "outputs": [],
   "source": [
    "def perform_analysis(symbol, df, investment):\n",
    "    df = df.reset_index()\n",
    "    df = calculate_keltner_channels(df)\n",
    "    df = apply_strategy_rules(df)\n",
    "    \n",
    "    entry_prices, exit_prices = execute_strategy(df)\n",
    "    profit_or_loss = calculate_strategy_profit(investment, entry_prices, exit_prices)\n",
    "    buy_hold_profit = calculate_buy_hold_profit(investment, df)\n",
    "    return profit_or_loss, buy_hold_profit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "id": "f183e1cd",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Backtesting using NASDAQ 100\n",
    "nasdaq_100_df = pd.read_csv('https://raw.githubusercontent.com/justmobiledev/python-algorithmic-trading/main/data/nasdaq_100.csv')\n",
    "nasdaq_100 = nasdaq_100_df['Symbol'].to_numpy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "id": "1ec9d01d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Backtest profit for symbol AAPL: $168, buy & hold: $226\n",
      "Backtest profit for symbol ABNB: $-115, buy & hold: $-85\n",
      "Backtest profit for symbol ADBE: $142, buy & hold: $-194\n",
      "Backtest profit for symbol ADI: $-124, buy & hold: $0\n",
      "Backtest profit for symbol ADP: $204, buy & hold: $147\n",
      "Backtest profit for symbol ADSK: $-59, buy & hold: $-349\n",
      "Backtest profit for symbol AEP: $138, buy & hold: $139\n",
      "Backtest profit for symbol ALGN: $-244, buy & hold: $-414\n",
      "Backtest profit for symbol AMAT: $-305, buy & hold: $-143\n",
      "Backtest profit for symbol AMD: $31, buy & hold: $114\n",
      "Backtest profit for symbol AMGN: $15, buy & hold: $-18\n",
      "Backtest profit for symbol AMZN: $5, buy & hold: $-127\n",
      "Backtest profit for symbol ANSS: $9, buy & hold: $-242\n",
      "Backtest profit for symbol ASML: $-41, buy & hold: $-61\n",
      "Backtest profit for symbol ATVI: $-16, buy & hold: $-161\n",
      "Backtest profit for symbol AVGO: $32, buy & hold: $289\n",
      "Backtest profit for symbol BIDU: $-385, buy & hold: $-466\n",
      "Backtest profit for symbol BIIB: $18, buy & hold: $-189\n",
      "Backtest profit for symbol BKNG: $-86, buy & hold: $-56\n",
      "Backtest profit for symbol CDNS: $197, buy & hold: $57\n",
      "Backtest profit for symbol CHTR: $64, buy & hold: $-222\n",
      "Backtest profit for symbol CMCSA: $-115, buy & hold: $-165\n",
      "Backtest profit for symbol COST: $257, buy & hold: $539\n",
      "Backtest profit for symbol CPRT: $26, buy & hold: $-54\n",
      "Backtest profit for symbol CRWD: $-97, buy & hold: $-51\n",
      "Backtest profit for symbol CSCO: $-17, buy & hold: $-2\n",
      "Backtest profit for symbol CSX: $-68, buy & hold: $17\n",
      "Backtest profit for symbol CTAS: $126, buy & hold: $170\n",
      "Backtest profit for symbol CTSH: $-172, buy & hold: $52\n",
      "Backtest profit for symbol DDOG: $329, buy & hold: $396\n",
      "Backtest profit for symbol DLTR: $197, buy & hold: $454\n",
      "Backtest profit for symbol DOCU: $-35, buy & hold: $-610\n",
      "Backtest profit for symbol DXCM: $578, buy & hold: $73\n",
      "Backtest profit for symbol EA: $-243, buy & hold: $-93\n",
      "Backtest profit for symbol EBAY: $-142, buy & hold: $-124\n",
      "Backtest profit for symbol EXC: $59, buy & hold: $513\n",
      "Backtest profit for symbol FAST: $121, buy & hold: $100\n",
      "Backtest profit for symbol FB: $-284, buy & hold: $-379\n",
      "Backtest profit for symbol FISV: $-196, buy & hold: $-218\n",
      "Backtest profit for symbol FTNT: $225, buy & hold: $512\n",
      "Backtest profit for symbol GILD: $-38, buy & hold: $-51\n",
      "Backtest profit for symbol GOOG: $-20, buy & hold: $54\n",
      "Backtest profit for symbol GOOGL: $-16, buy & hold: $62\n",
      "Backtest profit for symbol HON: $-73, buy & hold: $-168\n",
      "Backtest profit for symbol IDXX: $0, buy & hold: $-132\n",
      "Backtest profit for symbol ILMN: $-25, buy & hold: $-209\n",
      "Backtest profit for symbol INTC: $-261, buy & hold: $-256\n",
      "Backtest profit for symbol INTU: $232, buy & hold: $89\n",
      "Backtest profit for symbol ISRG: $-182, buy & hold: $-119\n",
      "Backtest profit for symbol JD: $-430, buy & hold: $-316\n",
      "Backtest profit for symbol KDP: $-72, buy & hold: $26\n",
      "Backtest profit for symbol KHC: $15, buy & hold: $53\n",
      "Backtest profit for symbol KLAC: $-135, buy & hold: $-2\n",
      "Backtest profit for symbol LCID: $25, buy & hold: $-27\n",
      "Backtest profit for symbol LRCX: $-139, buy & hold: $-246\n",
      "Backtest profit for symbol LULU: $274, buy & hold: $73\n",
      "Backtest profit for symbol MAR: $-27, buy & hold: $224\n",
      "Backtest profit for symbol MCHP: $-158, buy & hold: $-127\n",
      "Backtest profit for symbol MDLZ: $3, buy & hold: $92\n",
      "Backtest profit for symbol MELI: $-141, buy & hold: $-373\n",
      "Backtest profit for symbol MNST: $-20, buy & hold: $-121\n",
      "Backtest profit for symbol MRNA: $259, buy & hold: $-165\n",
      "Backtest profit for symbol MRVL: $103, buy & hold: $295\n",
      "Backtest profit for symbol MSFT: $175, buy & hold: $65\n",
      "Backtest profit for symbol MTCH: $-162, buy & hold: $-461\n",
      "Backtest profit for symbol MU: $-93, buy & hold: $-180\n",
      "Backtest profit for symbol NFLX: $60, buy & hold: $-576\n",
      "Backtest profit for symbol NTES: $-253, buy & hold: $-228\n",
      "Backtest profit for symbol NVDA: $366, buy & hold: $314\n",
      "Backtest profit for symbol NXPI: $-130, buy & hold: $-129\n",
      "Backtest profit for symbol OKTA: $-204, buy & hold: $-504\n",
      "Backtest profit for symbol ORLY: $-35, buy & hold: $336\n",
      "Backtest profit for symbol PANW: $-52, buy & hold: $620\n",
      "Backtest profit for symbol PAYX: $91, buy & hold: $336\n",
      "Backtest profit for symbol PCAR: $18, buy & hold: $-70\n",
      "Backtest profit for symbol PDD: $-513, buy & hold: $-739\n",
      "Backtest profit for symbol PEP: $90, buy & hold: $178\n",
      "Backtest profit for symbol PTON: $-425, buy & hold: $-799\n",
      "Backtest profit for symbol PYPL: $-38, buy & hold: $-671\n",
      "Backtest profit for symbol QCOM: $13, buy & hold: $-1\n",
      "Backtest profit for symbol REGN: $293, buy & hold: $403\n",
      "Backtest profit for symbol ROST: $-188, buy & hold: $-190\n",
      "Backtest profit for symbol SBUX: $-215, buy & hold: $-327\n",
      "Backtest profit for symbol SGEN: $-99, buy & hold: $-39\n",
      "Backtest profit for symbol SIRI: $-35, buy & hold: $-7\n",
      "Backtest profit for symbol SNPS: $89, buy & hold: $148\n",
      "Backtest profit for symbol SPLK: $-166, buy & hold: $-84\n",
      "Backtest profit for symbol SWKS: $-329, buy & hold: $-372\n",
      "Backtest profit for symbol TEAM: $-20, buy & hold: $73\n",
      "Backtest profit for symbol TMUS: $-33, buy & hold: $-23\n",
      "Backtest profit for symbol TSLA: $249, buy & hold: $396\n",
      "Backtest profit for symbol TXN: $-192, buy & hold: $-67\n",
      "Backtest profit for symbol VRSK: $225, buy & hold: $124\n",
      "Backtest profit for symbol VRSN: $-43, buy & hold: $-30\n",
      "Backtest profit for symbol VRTX: $70, buy & hold: $252\n",
      "Backtest profit for symbol WBA: $-58, buy & hold: $-133\n",
      "Backtest profit for symbol WDAY: $-115, buy & hold: $-185\n",
      "Backtest profit for symbol XEL: $-59, buy & hold: $44\n",
      "Error loading stock data for XLNX\n",
      "Backtest profit for symbol ZM: $46, buy & hold: $-694\n",
      "Backtest profit for symbol ZS: $305, buy & hold: $86\n",
      "\n",
      "Avg strategy profit per stock: $-19\n",
      "\n",
      "Avg buy & hold profit per stock: $-50\n"
     ]
    }
   ],
   "source": [
    "#  Backtesting\n",
    "total_strategy_profit = 0\n",
    "total_buy_hold_profit = 0\n",
    "for symbol in nasdaq_100:\n",
    "    df = load_historic_data(symbol)\n",
    "    if df is None or df.empty:\n",
    "        continue\n",
    "    df.reset_index(inplace=True)\n",
    "    \n",
    "    #  Random interval between remote fetch to avoid spam issues\n",
    "    random_secs = random.uniform(0, 1)\n",
    "    time.sleep(random_secs)\n",
    "    \n",
    "    #  Run backtest\n",
    "    profit, buy_hold_profit = perform_analysis(symbol, df, investment=investment) \n",
    "    print(f\"Backtest profit for symbol {symbol}: ${math.trunc(profit)}, buy & hold: ${math.trunc(buy_hold_profit)}\")\n",
    "    total_strategy_profit += profit\n",
    "    total_buy_hold_profit += buy_hold_profit\n",
    "  \n",
    "print(f\"\\nAvg strategy profit per stock: ${math.trunc(total_strategy_profit / len(nasdaq_100))}\")\n",
    "print(f\"\\nAvg buy & hold profit per stock: ${math.trunc(total_buy_hold_profit / len(nasdaq_100))}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:tradesystem1]",
   "language": "python",
   "name": "conda-env-tradesystem1-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
